﻿using System;

namespace IupNET
{

   

    public class Button : Control
    {

        //private CallbackHandler ActionHandler;
        //private CallbackHandlerIIIIS ButtonCBHandler;

        public Button()
            : base(Iupc.Button(null, null))
        {

            //ActionHandler = new CallbackHandler("ACTION", this);
            //ButtonCBHandler = new CallbackHandlerIIIIS("BUTTON_CB", this);

        }


        public EventCallback ButtonCB
        {
            get
            {
                return CBHandler.Fetch("BUTTON_CB");
            }
            set
            {
                CBHandler.Set("BUTTON_CB", value);
            }
        }

        public EventCallback Action
        {
            get
            {
                return CBHandler.Fetch("ACTION_BUTTON");
            }
            set
            {
                CBHandler.Set("ACTION_BUTTON",value);
            }
        }

        public Alignment Alignment
        { 
            get
            {
                return Convert.StringToAlign(GetAttribute("ALIGNMENT"));
            }
            set
            {
                SetAttribute("ALIGNMENT", Convert.AlignToString(value));
            }
        }

        public bool CanFocus
        {
            get
            {
                return GetAttribute("CANFOCUS") == "YES";
            }
            set
            {
                SetAttribute("CANFOCUS", value ? "YES" : "NO");
            }
        }

        public bool Flat
        {
            get
            {
                return GetAttribute("FLAT") == "YES";
            }
            set
            {
                SetAttribute("FLAT", value ? "YES" : "NO");
            }
        }

        public bool FocusOnClick
        {
            get
            {
                return GetAttribute("FOCUSONCLICK") == "YES";
            }
            set
            {
                SetAttribute("FOCUSONCLICK", value ? "YES" : "NO");
            }
        }

        public Image Image
        {
            set
            {
                string n = value.HandleName;
                if (n == null)
                    return;
                SetAttribute("IMAGE", n);
            }

        }

        public Image ImInactive
        {
            set
            {
                string n = value.HandleName;
                if (n == null)
                    return;
                SetAttribute("IMINACTIVE", n);
            }
        }

        public Image ImPress
        {
            set
            {
                string n = value.HandleName;
                if (n == null)
                    return;
                SetAttribute("IMPRESS", n);
            }
        }

        public bool ImPressBorder
        {
            get
            {
                return GetAttribute("IMPRESSBORDER") == "YES";
            }
            set
            {
                SetAttribute("IMPRESSBORDER", value ? "YES" : "NO");
            }
        }

        public TabPosition ImagePosition
        {
            get
            {
                return Convert.StringToPosition(GetAttribute("IMAGEPOSITION"));
            }
            set
            {
                SetAttribute("IMAGEPOSITION",Convert.PositionToString(value));
            }
        }

        public bool Markup
        {
            get
            {
                return GetAttribute("MARKUP") == "YES";
            }
            set
            {
                SetAttribute("MARKUP", value ? "YES" : "NO");
            }
        }

        public Size2i Padding
        {
            get
            {
                return Convert.StringToSize(GetAttribute("PADDING"));
            }
            set
            {
                SetAttribute("PADDING", Convert.SizeToString(value));
            }
        }

        public int Spacing
        {
            get
            {
                return Convert.StringToInt(GetAttribute("SPACING"));
            }
            set
            {
                SetAttribute("SPACING", value.ToString());
            }
        }





    }
}
